All guesses and secret numbers are integer numbers.
Implement the compare/2 function which takes two arguments, secret_number and guess, which are both integers.
Modify the compare function to respond to guesses that are higher than the secret number.
Modify the compare function to respond to guesses that are lower than the secret number.
Modify the compare function to respond to guesses that are close to the secret number.
Modify the compare function to respond to a lack of guess.
https://exercism.org/tracks/elixir/exercises/guessing-game
defmodule GuessingGame do
def compare(_, guess \\ :no_guess)
def compare(_, guess) when guess === :no_guess, do: "Make a guess"
def compare(secret_number, guess) when secret_number === guess, do: "Correct"
def compare(secret_number, guess) when secret_number + 1 < guess, do: "Too high"
def compare(secret_number, guess) when secret_number - 1 > guess, do: "Too low"
def compare(secret_number, guess) when guess in [secret_number + 1, secret_number - 1] , do: "So close"
end